import request from '@/api/axios'
import { getRefresToken, getToken } from './userToken'

// 登录保存token
export function login(data) {
    return request.post('/user/token', data)
}

// 刷新token
export function refreshToken() {
    let accessToken = getToken()
    let refreshToken = getRefresToken()
    let data = {
        accessToken,
        refreshToken
    }
    if (accessToken && refreshToken) {
        return request.post('/user/refreshtoken', data)
    }else{
        return false
    }
}